<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="${path}/statics/layui/css/layui.css">

</head>
<body>
	
     <form class="layui-form" action="" style = "padding : 10px;">
  <div class="layui-form-item">
    <label class="layui-form-label">甲方</label>
    <div class="layui-input-block">
      <input type="text" name="name" id="nameId"  lay-verify="required" lay-reqtext="甲方是必填项，岂能为空？" autocomplete="off" placeholder="请输入甲方" class="layui-input">
    </div>
  </div>
 
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">URL</label>
      <div class="layui-input-inline">
        <input type="tel" name="url" id="urlId" value="" lay-verify="required" lay-reqtext="URL是必填项，岂能为空？" placeholder="请输入URL" autocomplete="off" class="layui-input">
      </div>
    </div>
  
  
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button type="submit" class="layui-btn" name="submit" id="saveBtnID" lay-submit lay-filter="saveBtn">保存</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>
  
	
<script src="${path}/statics/layui/layui.js"></script>
<script src="${path}/statics/ckeditor/ckeditor.js"></script>
<script src="${path}/statics/ckfinder/ckfinder.js"></script>
<script>
//JavaScript代码区域


layui.use(['form','laydate','jquery','layer',"table"], function(){
  var form = layui.form;
  var $ = layui.jquery;
  var layer = layui.layer;
  var table = layui.table;
  var laydate = layui.laydate //日期
  	
 // var editor = CKEDITOR.replace('content');
  //CKFinder.setupCKEditor(editor,'${path}/statics/ckfinder/');
	  //监听表单的提交,首先会触发表单的验证,
	form.on('submit(saveBtn)', function(data){
		
		//$("#contentId").val(CKEDITOR.instances.contentId.getData());
		
	  $.post("${path}/linkCtl/save",$(data.form).serialize(),function(res){
		  
		  if(res == 0){
			  layer.msg("保存成功",{icon:1},function(){
				  var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
				  parent.layer.close(index); //再执行关闭  
				  
				  //在父级自定义函数 , 在子级调用
				  parent.tools.reloadTable();
			  });
			  
		  }else{
			  layer.msg("系统繁忙,请稍后",{icon:2});
		  }
		
	  })
	  return false;//阻止layui同步表单提交
	});
 
}); 
</script>



</body>
</html>